import { $axios } from '@/utils/http';

// 买家 / 管理员获取聊天记录列表
export async function getSaleList(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/conversation/getSaleListID',
    method: 'GET',
    params,
  });
}

// 商家获取聊天记录列表
export async function getUserListID(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/conversation/getUserListID',
    method: 'GET',
    params,
  });
}

// 单独的聊天记录
export async function getTalkingByUserIDBack(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/conversation/getTalkingByUserID',
    method: 'GET',
    params,
  });
}

// 单独的聊天记录(买家 / 管理员)
export async function getTalkingBySaleId(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/conversation/getTalkingBySaleId',
    method: 'GET',
    params,
  });
}

// 商家发消息
export async function saleSend(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/conversation/saleSend',
    method: 'POST',
    params,
  });
}

// 买家发消息
export async function userSend(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/conversation/userSend',
    method: 'POST',
    params,
  });
}
